<?php 
require_once("include/utils.php");
require_once("include/scripts.js");

if(checkSession())
{
		echo "<meta http-equiv='refresh' content==0;'home.php' />";
}
elseif(!empty($_REQUEST['usr']) && !empty($_REQUEST['pwd']))
{
		if(set_session($_REQUEST['usr'], $_REQUEST['pwd']))
				echo "<meta http-equiv='refresh' content==0;'home.php' />";
		else
				errorMSG();
		
}
else
{
/* start here when login failed */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LogIn</title>

<style type = "text/css">
table {width:"195"; border:none;}
td#ls {width:65; text-align:right; font-family:Georgia, "Times New Roman", Times, serif; }


</style>
</head>

<body>
	 <h1 style="color:#F00;" >Member Login</h1>

   	 <h2 style="color:#F00;">Please Sign In to see all content.</h2>
<table style align="center">
  <form id = "signin" name="form" method="post" action="index.php" onsubmit= "return validateSignIn(this)">
  <tr>
    <td id = "ls">username::</td>
    <td><input type="text" name="usr" id="usr" />
    </td>
  </tr>
  <tr>
    <td id = "ls">password::</td>
    <td><input type="password" name="pwd" id="pwd" />
    </td>
  </tr>
  <tr>
    <td>
    </td>
    <td><input type="submit" name="sign_in" id="sign_in" value="Sign In" />
    </td>
  </tr>
  </form>
</table>
</body>
</html>
<?php
} //end of signIn form 
?>